package com.tiange.service;

import com.tiange.base.CashSuper;

public class CashReturn extends CashSuper {
	
	private double moneyCondition = 0d;
	private double moneyReturn    = 0d;
	
	public CashReturn(String moneyCondition, String moneyReturn) {
        this.moneyCondition = Double.parseDouble(moneyCondition);
        this.moneyReturn    = Double.parseDouble(moneyReturn);
	}

	@Override
	public double acceptCash(double money) {
		double result = money;
		if (money >= moneyCondition)
			result = money - Math.floor(money / moneyCondition) * moneyReturn;
		return result;
	}

}
